#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: v2_api_url_base.py 
@version:
@time: 2022/03/01 
"""
from TapClientCore.T02_tm_api.api_base_path import *
from TapClientCore.T01_init_conf.v2_init.init_config import config
from TapClientCore.T02_tm_api.api_util.util_func import *


class V2ApiUrlBase:
    def __init__(self):
        self.setting = config
        self.serve = self.setting['serve']
        self.apiserve = self.setting['apiserve']
        if self.serve in ["http://test.cloud.tapdata.net",
                          "https://cloud.tapdata.net",
                          'http://sit.cloud.tapdata.net']:
            self._api = api_joint(TM, API)
            self.server = api_joint(self.serve, self._api).replace('/tm/', '/console/tm/')
        else:
            self._api = API
            self.server = api_joint(self.serve, self._api)
            if self.apiserve:
                self.apiserver = api_joint(self.apiserve, self._api)
